<?php
/**
 * Created by PhpStorm.
 * User: apple
 * Date: 2020/10/18
 * Time: 3:23 PM
 */
namespace app\admin\controller;


use app\admin\logic\GoodsLogic;
use app\admin\logic\IntegralLogic;
use app\BaseController;

use think\App;
use think\facade\Request;

class Integral extends BaseController
{

    public function __construct()
    {
//        logend(config('user'));
//        if(config('user')['position'] != \app\model\User::SYS_ADMIN)   fail('暂无权限');
    }

    /*
     * 列表
     */
    public function index()
    {
        $logic = new IntegralLogic();
        success($logic->getList());
    }

    public function pass()
    {

        $param = Request::post();
        if(!isset($param['goodsExchangeId']) || empty($param['goodsExchangeId']))   fail('请选择积分兑换记录');
        $goodsExchangeId = intval($param['goodsExchangeId']);

        $logic = new IntegralLogic();
        success($logic->pass($goodsExchangeId));
    }

}